package thinking.java.initalization.and.clean.up;

/**
 * @author GaoFeng
 * @date 2020/1/3 15:03
 */
public class NewVarArgs {

    static class A {

    }

    static void printArray(Object... args) {
        for (Object object : args) {
            System.out.println(object + " ");
        }
    }

    public static void main(String[] main) {

        printArray(new Integer(47), new Float(3.14f), new Double(11.11));

        // 自动装箱
        printArray("one", "two", "three");

        // 对象数组
        printArray(new A(), new A(), new A());

        // 其他类型数组强制转型
        printArray((Object[]) new Integer[]{1, 2, 3, 4});

        // 无参数，默认为0
        printArray();

    }



}
